/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bookstore.action;
import com.opensymphony.xwork2.*;
import bookstore.iservice.*;
import bookstore.service.*;
import bookstore.dao.*;
import bookstore.model.*;
import static com.opensymphony.xwork2.Action.ERROR;
import static com.opensymphony.xwork2.Action.LOGIN;
import static com.opensymphony.xwork2.Action.SUCCESS;
import static java.lang.System.out;
import java.util.Map;
/**
 *
 * @author cjx
 */
public class CustomeInfo extends ActionSupport
{
    private ICustomerService bsCustomerService =new CustomerService();
    private String name;
     private String realName;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getZipcode() {
        return zipcode;
    }

    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }
      private String phone;
       private String email;
        private String address;
         private String zipcode;
   public String execute()
   {
       ActionContext ctx = ActionContext.getContext();
       Map session = ctx.getSession();
       Customer cus = (Customer)session.get("bsCustomer");
       bsCustomerService.setCustomerDao(new CustomerDao());
       Customer bsCustomer=bsCustomerService.findCustomerByNameAndPassword(cus.getName(),cus.getPassword());
       cus.setAddress(address);
       cus.setEmail(email);
       cus.setRealName(realName);
       cus.setPhone(phone);
       cus.setZipcode(zipcode);
       session.put("bsCustomer", cus);
       session.put("isinfo",1);
       bsCustomerService.editMessage(cus);
       return SUCCESS;
      
   }
    
}
